import { createRouter, createWebHashHistory } from 'vue-router'
const Login = () => import('@/views/Login/index.vue')
const Layout = () => import('@/views/Layout/index.vue')
const Home = () => import('@/views/Home/index.vue')
const Category = () => import('@/views/Category/index.vue')

const routes = [
  {
    path: '/',
    name: 'layout',
    component: Layout,
    children: [
      {
        path: '',
        name: 'home',
        component: Home
      },
      {
        path: 'category/:id',
        name: 'category',
        component: Category
      },
      {
        path: 'goods/:id',
        name: 'goods',
        component: () => import('@/views/goods/Goods.vue')
      },
      {
        path: '/settlement',
        name: 'settlement',
        component: () => import('@/views/settlement/index.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        component: () => import('@/views/Cart/Cart.vue')
      },
      {
        path: '/pay',
        name: 'pay',
        component: () => import('@/views/Pay/Pay.vue')
      },
      {
        path: '/pay/callback',
        name: 'callback',
        component: () => import('@/views/Pay/callback.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  }

]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
